package org.zju.demo.service.impl;

import org.zju.demo.model.UAVStatus;
import org.zju.demo.service.intf.UavStatusInft;
import org.zju.demo.utils.HibernateUtil;

import java.util.List;

/**
 * Created by ZJDX on 2015/9/17.
 */
public class UavStatusService implements UavStatusInft {
    public void add(UAVStatus uavStatus) {
        HibernateUtil.save(uavStatus);
    }

    public List<UAVStatus> query(int id) {
        String hql = "from UAVStatus where id=?";
        String[] paramters = {Integer.toString(id)};

        return HibernateUtil.executeQuery(hql, paramters);
    }

    public List<UAVStatus> query(int id, int n) {
        String hql = "from UAVStatus where id=?";
        String[] paramters = {Integer.toString(id)};

        return HibernateUtil.executeQueryFinalNRecords(hql, paramters, n);
    }
}
